package cn.tom.basic.vali;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 自定义注解：@Phone - 校验手机号码
 */
@Target( ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = cn.tom.basic.vali.PhoneValidator.class)//此处指定了校验规则/器
public @interface Phone {
    //SpringValidator必要的三个属性
    String message() default "无效的手机格式";
    //分组校验时用
    Class<?>[] groups() default {};
    //打印出异常信息
    Class<? extends Payload>[] payload() default {};
}